{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style type="text/css">
    #des,#des input{ width: 40px;text-align:center;}
    #id{ width: 78px; }
    .bs-checkbox{ width: 36px; height: 40px }
    .fixed-table-toolbar .columns,.fixed-table-toolbar .search{margin-left:0px; margin-top: 0px }
    #title span{ float: right; }
    .asdlkjasd {
        background: #1ab394;
        color: #fff;
    }
    .ibox-content {
        clear: both;
        overflow-x: auto;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="wrapper wrapper-content {:config('adminClass.main')}">
            <div class="ibox float-e-margins">
                {include file="public/tophead"}
                {include file="public/top" /}
                <div class="ibox-content">
                    {include file="public/topsection"}
                    <div class="row row-lg">
                        <div class="col-sm-12">
                            <div class="fixed-table-toolbar" style="text-align: center;margin-bottom: 20px">
                                <h2>总收益: <font color="#1ab394">{:number_format($shouyi / 10, 2)}</font></h2>
                            </div>
                            <div class="fixed-table-toolbar">
                                <a class="btn btn-default btn-outline {present name='date'}{else /}asdlkjasd{/present}" href="{:url('shouyirecords')}{present name='next'}/next/{$next}{/present}">全部</a>
                                <a class="btn btn-default btn-outline {eq name='date' value='1'}asdlkjasd{/eq}" href="{:url('shouyirecords',['date'=>1])}{present name='next'}/next/{$next}{/present}">今日</a>
                                <a class="btn btn-default btn-outline {eq name='date' value='2'}asdlkjasd{/eq}" href="{:url('shouyirecords',['date'=>2])}{present name='next'}/next/{$next}{/present}">昨日</a>
                                <a class="btn btn-default btn-outline {eq name='date' value='3'}asdlkjasd{/eq}" href="{:url('shouyirecords',['date'=>3])}{present name='next'}/next/{$next}{/present}">本月</a>
                                <a class="btn btn-default btn-outline {eq name='date' value='4'}asdlkjasd{/eq}" href="{:url('shouyirecords',['date'=>4])}{present name='next'}/next/{$next}{/present}">上月</a>
                            </div>
                            <div style="display:block;clear: both;"></div>
                            <div class="fixed-table-toolbar">
                                <form  method="get" action="" style="display: flex;">
                                    <div class="pull-left search" style="display: flex;">
                                        <div class="columns columns-right btn-group pull-left">
                                            <select class="form-control" name="search">
                                                <option value="touid" {php}if(input('?param.search')){if(input('param.search')=='touid'){echo "selected";} }{/php}>会员ID</option>
                                            </select>
                                        </div>
                                        <div class="pull-right search">
                                            <input class="form-control input-outline" type="text"
                                                   {php}
                                                   if(input('?param.name')){
                                            if(input('param.name')){
                                            echo "value='".input('name')."'";
                                            }

                                            }
                                            {/php}
                                            name="name" placeholder="搜索">
                                        </div>

                                        <div class="pull-right search">
                                            <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                        </div>

                                        <input name="start" type="text" id="start" class="form-control layui-input" value="{present name='start'}{$start}{/present}" placeholder=" # 起始时间" autocomplete="off" style="height:34px;width:100px;margin:0 10px;">
                                        <input name="end" type="text" id="end" class="form-control layui-input" value="{present name='end'}{$end}{/present}" placeholder=" # 结束时间" autocomplete="off" style="height:34px;width:100px;margin:0 10px;">

                                        {php}
                                        if(input('?param.name')){
                                        {/php}
                                        <div class="pull-right search">
                                            <a class="btn btn-w-m btn-link" href="{:url('shouyirecords')}{present name='next'}/next/{$next}{/present}">返回管理</a>
                                        </div>{php}
                                        }
                                        {/php}


                                    </div>
                                </form>
                            </div>

                            <div class="example">
                                <form class="form-horizontal" method="post">
                                    <table data-toggle="table">
                                        <thead>
                                        <tr>
                                            <th data-align="center">ID</th>
                                            <th data-align="center">用户</th>
                                            <th data-align="center">收益</th>
                                            <th data-align="center">描述</th>
                                            <th data-align="center">时间</th>
                                        </tr>
                                        </thead>
                                        <tbody id="form">
                                        {volist name="data" id="v"}
                                        <tr id="id{$v.id}" class="class">
                                            <td>{eq name='$next' value='1'}{$v.uid}{else /}{$v.touid}{/eq}</td>
                                            <?php
                                                if ($next) {
                                                    $user = db('user')->find($v['uid']);
                                                } else {
                                                    $user = db('user')->find($v['touid']);
                                                }
                                            ?>
                                            <td>
                                                {if condition='$user.phone'}
                                                    {$user.name} <br/>({$user.phone})
                                                {/if}
                                            </td>
                                            <td><font color="#f00">+{$v.money / 10}</font></td>
                                            <td>{$v.content}</td>
                                            <td><span {php}if(date('Ymd')==date('Ymd',strtotime($v['time'])))echo 'style="color: #ed5565"';{/php}>{$v.time|date='Y-m-d H:i:s',###}</span></td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>
                    <hr>
                    <div class="row row-lg">
                        <div class="col-sm-12 pages">{$page}</div>
                    </div>
                </div>
            </div>
        </div>
{include file="public/footer" /}
<script type="text/javascript">
    function del(id){
        swal_del(id,"{:url('del')}")
    }

    layui.use(['laydate'], function(){
        var laydate = layui.laydate;

        laydate.render({
            elem: '#start' //指定元素
            ,type: 'date'
            ,trigger: 'click'
        });

        laydate.render({
            elem: '#end' //指定元素
            ,type: 'date'
            ,trigger: 'click'
        });
    })

    function swal_end(id,url,data){
        swal({
                title: "您确定要关闭会员吗",
                text: "",
                type: "",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "确定",
                cancelButtonText: "取消",
            },
            function(isConfirm) {
                if (isConfirm) {
                    var index = layer.load(1, {
                        // shade: [0.1,'#fff'] //0.1透明度的白色背景
                    });
                    ajaxFun("post",url,{id:id},'json',function(ret){
                        if(ret){
                            if(ret.ret){
                                layer.msg(ret.ret)
                                $("#id"+id).hide('fast',function(){
                                    $("#id"+id).remove();
                                })
                            }else{
                                layer.msg(ret.err)
                            }
                        }else{
                            swal_msg("错误",ret,"error");
                        }
                        layer.close(index);
                    })
                }
            })
    }
</script>